package cn.edu.hpu.web;


import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import cn.edu.hpu.dao.IdeaCommentDao;
import cn.edu.hpu.entity.Employee;
import cn.edu.hpu.entity.IdeaComment;
import cn.edu.hpu.utitl.TimeUtitl;

public class IcupdateSerclet extends HttpServlet {

	private static final long serialVersionUID = 1L;
	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String icid = request.getParameter("id");
		String iccontent = request.getParameter("iccontent");
		HttpSession session = request.getSession();
		Employee e = (Employee)session.getAttribute("employee");
		String eid = e.getEid();
		String icctime = TimeUtitl.getTime();
		String iid = request.getParameter("iid");
		IdeaComment ic = new IdeaComment();
		ic.setIccontent(iccontent);
		ic.setEid(eid);
		ic.setIcctime(icctime);
		ic.setIcid(icid);
		ic.setIid(iid);
		IdeaCommentDao icd = new IdeaCommentDao();
		icd.icupdate(iccontent, icid);
		request.getRequestDispatcher("/WEB-INF/views/idea.jsp").forward(request, response);
	}
}
